//路由守卫组件
import React from 'react'
import {Navigate} from 'react-router-dom'
import {useSelector} from 'react-redux'
// let isLogin = true  //模拟登录状态
export default function RequireAuth(props) {
  const {isLogin} = useSelector(({user})=>user)
  return (
    <div>
      {/* 守卫组件 */}
      {isLogin ? props.children : <Navigate to="/login"/>}
    </div>
  )
}
